#ifdef _WINDOWS
#include <Windows.h>
#include "common.h"
#endif

//#include <time.h> ??

#include "ODBCWrapper.h"

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <boost/thread/mutex.hpp>

using namespace std;

#define LOG_PREFIX "[ODBC Logging Driver] "

/*static*/ DynLib *ODBCWrapper::odbcLib = NULL;

//// Instantiation of static function variables - generated code ////
/*static*/ _fn_SQLAllocHandleType* ODBCWrapper::_fn_SQLAllocHandle = NULL;
/*static*/ _fn_SQLBindColType* ODBCWrapper::_fn_SQLBindCol = NULL;
/*static*/ _fn_SQLBindParameterType* ODBCWrapper::_fn_SQLBindParameter = NULL;
/*static*/ _fn_SQLBrowseConnectType* ODBCWrapper::_fn_SQLBrowseConnect = NULL;
/*static*/ _fn_SQLBrowseConnectWType* ODBCWrapper::_fn_SQLBrowseConnectW = NULL;
/*static*/ _fn_SQLBulkOperationsType* ODBCWrapper::_fn_SQLBulkOperations = NULL;
/*static*/ _fn_SQLCancelType* ODBCWrapper::_fn_SQLCancel = NULL;
/*static*/ _fn_SQLCloseCursorType* ODBCWrapper::_fn_SQLCloseCursor = NULL;
#ifdef _WIN64
/*static*/ _fn_SQLColAttributeType* ODBCWrapper::_fn_SQLColAttribute = NULL;
/*static*/ _fn_SQLColAttributeWType* ODBCWrapper::_fn_SQLColAttributeW = NULL;
#else
/*static*/ _fn_SQLColAttributeType* ODBCWrapper::_fn_SQLColAttribute = NULL;
/*static*/ _fn_SQLColAttributeWType* ODBCWrapper::_fn_SQLColAttributeW = NULL;
#endif
/*static*/ _fn_SQLColumnPrivilegesType* ODBCWrapper::_fn_SQLColumnPrivileges = NULL;
/*static*/ _fn_SQLColumnPrivilegesWType* ODBCWrapper::_fn_SQLColumnPrivilegesW = NULL;
/*static*/ _fn_SQLColumnsType* ODBCWrapper::_fn_SQLColumns = NULL;
/*static*/ _fn_SQLColumnsWType* ODBCWrapper::_fn_SQLColumnsW = NULL;
/*static*/ _fn_SQLConnectType* ODBCWrapper::_fn_SQLConnect = NULL;
/*static*/ _fn_SQLConnectWType* ODBCWrapper::_fn_SQLConnectW = NULL;
/*static*/ _fn_SQLCopyDescType* ODBCWrapper::_fn_SQLCopyDesc = NULL;
/*static*/ _fn_SQLDescribeColType* ODBCWrapper::_fn_SQLDescribeCol = NULL;
/*static*/ _fn_SQLDescribeColWType* ODBCWrapper::_fn_SQLDescribeColW = NULL;
/*static*/ _fn_SQLDescribeParamType* ODBCWrapper::_fn_SQLDescribeParam = NULL;
/*static*/ _fn_SQLDisconnectType* ODBCWrapper::_fn_SQLDisconnect = NULL;
/*static*/ _fn_SQLDriverConnectType* ODBCWrapper::_fn_SQLDriverConnect = NULL;
/*static*/ _fn_SQLDriverConnectWType* ODBCWrapper::_fn_SQLDriverConnectW = NULL;
/*static*/ _fn_SQLEndTranType* ODBCWrapper::_fn_SQLEndTran = NULL;
/*static*/ _fn_SQLExecDirectType* ODBCWrapper::_fn_SQLExecDirect = NULL;
/*static*/ _fn_SQLExecDirectWType* ODBCWrapper::_fn_SQLExecDirectW = NULL;
/*static*/ _fn_SQLExecuteType* ODBCWrapper::_fn_SQLExecute = NULL;
/*static*/ _fn_SQLFetchType* ODBCWrapper::_fn_SQLFetch = NULL;
/*static*/ _fn_SQLFetchScrollType* ODBCWrapper::_fn_SQLFetchScroll = NULL;
/*static*/ _fn_SQLForeignKeysType* ODBCWrapper::_fn_SQLForeignKeys = NULL;
/*static*/ _fn_SQLForeignKeysWType* ODBCWrapper::_fn_SQLForeignKeysW = NULL;
/*static*/ _fn_SQLFreeStmtType* ODBCWrapper::_fn_SQLFreeStmt = NULL;
/*static*/ _fn_SQLFreeHandleType* ODBCWrapper::_fn_SQLFreeHandle = NULL;
/*static*/ _fn_SQLGetConnectAttrType* ODBCWrapper::_fn_SQLGetConnectAttr = NULL;
/*static*/ _fn_SQLGetConnectAttrWType* ODBCWrapper::_fn_SQLGetConnectAttrW = NULL;
/*static*/ _fn_SQLGetCursorNameType* ODBCWrapper::_fn_SQLGetCursorName = NULL;
/*static*/ _fn_SQLGetCursorNameWType* ODBCWrapper::_fn_SQLGetCursorNameW = NULL;
/*static*/ _fn_SQLGetDataType* ODBCWrapper::_fn_SQLGetData = NULL;
/*static*/ _fn_SQLGetDescFieldType* ODBCWrapper::_fn_SQLGetDescField = NULL;
/*static*/ _fn_SQLGetDescFieldWType* ODBCWrapper::_fn_SQLGetDescFieldW = NULL;
/*static*/ _fn_SQLGetDescRecType* ODBCWrapper::_fn_SQLGetDescRec = NULL;
/*static*/ _fn_SQLGetDescRecWType* ODBCWrapper::_fn_SQLGetDescRecW = NULL;
/*static*/ _fn_SQLGetDiagFieldType* ODBCWrapper::_fn_SQLGetDiagField = NULL;
/*static*/ _fn_SQLGetDiagFieldWType* ODBCWrapper::_fn_SQLGetDiagFieldW = NULL;
/*static*/ _fn_SQLGetDiagRecType* ODBCWrapper::_fn_SQLGetDiagRec = NULL;
/*static*/ _fn_SQLGetDiagRecWType* ODBCWrapper::_fn_SQLGetDiagRecW = NULL;
/*static*/ _fn_SQLGetEnvAttrType* ODBCWrapper::_fn_SQLGetEnvAttr = NULL;
/*static*/ _fn_SQLGetInfoType* ODBCWrapper::_fn_SQLGetInfo = NULL;
/*static*/ _fn_SQLGetInfoWType* ODBCWrapper::_fn_SQLGetInfoW = NULL;
/*static*/ _fn_SQLGetStmtAttrType* ODBCWrapper::_fn_SQLGetStmtAttr = NULL;
/*static*/ _fn_SQLGetStmtAttrWType* ODBCWrapper::_fn_SQLGetStmtAttrW = NULL;
/*static*/ _fn_SQLGetTypeInfoType* ODBCWrapper::_fn_SQLGetTypeInfo = NULL;
/*static*/ _fn_SQLGetTypeInfoWType* ODBCWrapper::_fn_SQLGetTypeInfoW = NULL;
/*static*/ _fn_SQLMoreResultsType* ODBCWrapper::_fn_SQLMoreResults = NULL;
/*static*/ _fn_SQLNativeSqlType* ODBCWrapper::_fn_SQLNativeSql = NULL;
/*static*/ _fn_SQLNativeSqlWType* ODBCWrapper::_fn_SQLNativeSqlW = NULL;
/*static*/ _fn_SQLNumResultColsType* ODBCWrapper::_fn_SQLNumResultCols = NULL;
/*static*/ _fn_SQLParamDataType* ODBCWrapper::_fn_SQLParamData = NULL;
/*static*/ _fn_SQLPrepareType* ODBCWrapper::_fn_SQLPrepare = NULL;
/*static*/ _fn_SQLPrepareWType* ODBCWrapper::_fn_SQLPrepareW = NULL;
/*static*/ _fn_SQLPrimaryKeysType* ODBCWrapper::_fn_SQLPrimaryKeys = NULL;
/*static*/ _fn_SQLPrimaryKeysWType* ODBCWrapper::_fn_SQLPrimaryKeysW = NULL;
/*static*/ _fn_SQLProcedureColumnsType* ODBCWrapper::_fn_SQLProcedureColumns = NULL;
/*static*/ _fn_SQLProcedureColumnsWType* ODBCWrapper::_fn_SQLProcedureColumnsW = NULL;
/*static*/ _fn_SQLProceduresType* ODBCWrapper::_fn_SQLProcedures = NULL;
/*static*/ _fn_SQLProceduresWType* ODBCWrapper::_fn_SQLProceduresW = NULL;
/*static*/ _fn_SQLPutDataType* ODBCWrapper::_fn_SQLPutData = NULL;
/*static*/ _fn_SQLRowCountType* ODBCWrapper::_fn_SQLRowCount = NULL;
/*static*/ _fn_SQLSetConnectAttrType* ODBCWrapper::_fn_SQLSetConnectAttr = NULL;
/*static*/ _fn_SQLSetConnectAttrWType* ODBCWrapper::_fn_SQLSetConnectAttrW = NULL;
/*static*/ _fn_SQLSetCursorNameType* ODBCWrapper::_fn_SQLSetCursorName = NULL;
/*static*/ _fn_SQLSetCursorNameWType* ODBCWrapper::_fn_SQLSetCursorNameW = NULL;
/*static*/ _fn_SQLSetDescFieldType* ODBCWrapper::_fn_SQLSetDescField = NULL;
/*static*/ _fn_SQLSetDescFieldWType* ODBCWrapper::_fn_SQLSetDescFieldW = NULL;
/*static*/ _fn_SQLSetDescRecType* ODBCWrapper::_fn_SQLSetDescRec = NULL;
/*static*/ _fn_SQLSetEnvAttrType* ODBCWrapper::_fn_SQLSetEnvAttr = NULL;
/*static*/ _fn_SQLSetPosType* ODBCWrapper::_fn_SQLSetPos = NULL;
/*static*/ _fn_SQLSetScrollOptionsType* ODBCWrapper::_fn_SQLSetScrollOptions = NULL;
/*static*/ _fn_SQLSetStmtAttrType* ODBCWrapper::_fn_SQLSetStmtAttr = NULL;
/*static*/ _fn_SQLSetStmtAttrWType* ODBCWrapper::_fn_SQLSetStmtAttrW = NULL;
/*static*/ _fn_SQLSpecialColumnsType* ODBCWrapper::_fn_SQLSpecialColumns = NULL;
/*static*/ _fn_SQLSpecialColumnsWType* ODBCWrapper::_fn_SQLSpecialColumnsW = NULL;
/*static*/ _fn_SQLStatisticsType* ODBCWrapper::_fn_SQLStatistics = NULL;
/*static*/ _fn_SQLStatisticsWType* ODBCWrapper::_fn_SQLStatisticsW = NULL;
/*static*/ _fn_SQLTablePrivilegesType* ODBCWrapper::_fn_SQLTablePrivileges = NULL;
/*static*/ _fn_SQLTablePrivilegesWType* ODBCWrapper::_fn_SQLTablePrivilegesW = NULL;
/*static*/ _fn_SQLTablesType* ODBCWrapper::_fn_SQLTables = NULL;
/*static*/ _fn_SQLTablesWType* ODBCWrapper::_fn_SQLTablesW = NULL;
/*static*/ _fn_SQLTransactType* ODBCWrapper::_fn_SQLTransact = NULL;
//// Instantiation of static function variables END - generated code ////

ODBCWrapper::ODBCWrapper(const char *_libraryPath) {
    initDone = false;
    libraryPath = _libraryPath;
}

ODBCWrapper::~ODBCWrapper() {
}

bool ODBCWrapper::init() {

    boost::mutex::scoped_lock lock(initMutex);

    if (initDone) {
        return true;
    }

	odbcLib = new DynLib(libraryPath);

	// Function lookup - generated code
	_fn_SQLAllocHandle = (_fn_SQLAllocHandleType*) resolve("SQLAllocHandle");
	if (_fn_SQLAllocHandle == NULL) {
		wcerr << L"Failed to load function: SQLAllocHandle";
	}
	_fn_SQLBindCol = (_fn_SQLBindColType*) resolve("SQLBindCol");
	if (_fn_SQLBindCol == NULL) {
		wcerr << L"Failed to load function: SQLBindCol";
	}
	_fn_SQLBindParameter = (_fn_SQLBindParameterType*) resolve("SQLBindParameter");
	if (_fn_SQLBindParameter == NULL) {
		wcerr << L"Failed to load function: SQLBindParameter";
	}
	_fn_SQLBrowseConnect = (_fn_SQLBrowseConnectType*) resolve("SQLBrowseConnect");
	if (_fn_SQLBrowseConnect == NULL) {
		wcerr << L"Failed to load function: SQLBrowseConnect";
	}
	_fn_SQLBrowseConnectW = (_fn_SQLBrowseConnectWType*) resolve("SQLBrowseConnectW");
	if (_fn_SQLBrowseConnectW == NULL) {
		wcerr << L"Failed to load function: SQLBrowseConnectW";
	}
	_fn_SQLBulkOperations = (_fn_SQLBulkOperationsType*) resolve("SQLBulkOperations");
	if (_fn_SQLBulkOperations == NULL) {
		wcerr << L"Failed to load function: SQLBulkOperations";
	}
	_fn_SQLCancel = (_fn_SQLCancelType*) resolve("SQLCancel");
	if (_fn_SQLCancel == NULL) {
		wcerr << L"Failed to load function: SQLCancel";
	}
	_fn_SQLCloseCursor = (_fn_SQLCloseCursorType*) resolve("SQLCloseCursor");
	if (_fn_SQLCloseCursor == NULL) {
		wcerr << L"Failed to load function: SQLCloseCursor";
	}
#ifdef _WIN64
	_fn_SQLColAttribute = (_fn_SQLColAttributeType*) resolve("SQLColAttribute");
	if (_fn_SQLColAttribute == NULL) {
		wcerr << L"Failed to load function: SQLColAttribute";
	}
	_fn_SQLColAttributeW = (_fn_SQLColAttributeWType*) resolve("SQLColAttributeW");
	if (_fn_SQLColAttributeW == NULL) {
		wcerr << L"Failed to load function: SQLColAttributeW";
	}
#else
	_fn_SQLColAttribute = (_fn_SQLColAttributeType*) resolve("SQLColAttribute");
	if (_fn_SQLColAttribute == NULL) {
		wcerr << L"Failed to load function: SQLColAttribute";
	}
	_fn_SQLColAttributeW = (_fn_SQLColAttributeWType*) resolve("SQLColAttributeW");
	if (_fn_SQLColAttributeW == NULL) {
		wcerr << L"Failed to load function: SQLColAttributeW";
	}
#endif
	_fn_SQLColumnPrivileges = (_fn_SQLColumnPrivilegesType*) resolve("SQLColumnPrivileges");
	if (_fn_SQLColumnPrivileges == NULL) {
		wcerr << L"Failed to load function: SQLColumnPrivileges";
	}
	_fn_SQLColumnPrivilegesW = (_fn_SQLColumnPrivilegesWType*) resolve("SQLColumnPrivilegesW");
	if (_fn_SQLColumnPrivilegesW == NULL) {
		wcerr << L"Failed to load function: SQLColumnPrivilegesW";
	}
	_fn_SQLColumns = (_fn_SQLColumnsType*) resolve("SQLColumns");
	if (_fn_SQLColumns == NULL) {
		wcerr << L"Failed to load function: SQLColumns";
	}
	_fn_SQLColumnsW = (_fn_SQLColumnsWType*) resolve("SQLColumnsW");
	if (_fn_SQLColumnsW == NULL) {
		wcerr << L"Failed to load function: SQLColumnsW";
	}
	_fn_SQLConnect = (_fn_SQLConnectType*) resolve("SQLConnect");
	if (_fn_SQLConnect == NULL) {
		wcerr << L"Failed to load function: SQLConnect";
	}
	_fn_SQLConnectW = (_fn_SQLConnectWType*) resolve("SQLConnectW");
	if (_fn_SQLConnectW == NULL) {
		wcerr << L"Failed to load function: SQLConnectW";
	}
	_fn_SQLCopyDesc = (_fn_SQLCopyDescType*) resolve("SQLCopyDesc");
	if (_fn_SQLCopyDesc == NULL) {
		wcerr << L"Failed to load function: SQLCopyDesc";
	}
	_fn_SQLDescribeCol = (_fn_SQLDescribeColType*) resolve("SQLDescribeCol");
	if (_fn_SQLDescribeCol == NULL) {
		wcerr << L"Failed to load function: SQLDescribeCol";
	}
	_fn_SQLDescribeColW = (_fn_SQLDescribeColWType*) resolve("SQLDescribeColW");
	if (_fn_SQLDescribeColW == NULL) {
		wcerr << L"Failed to load function: SQLDescribeColW";
	}
	_fn_SQLDescribeParam = (_fn_SQLDescribeParamType*) resolve("SQLDescribeParam");
	if (_fn_SQLDescribeParam == NULL) {
		wcerr << L"Failed to load function: SQLDescribeParam";
	}
	_fn_SQLDisconnect = (_fn_SQLDisconnectType*) resolve("SQLDisconnect");
	if (_fn_SQLDisconnect == NULL) {
		wcerr << L"Failed to load function: SQLDisconnect";
	}
	_fn_SQLDriverConnect = (_fn_SQLDriverConnectType*) resolve("SQLDriverConnect");
	if (_fn_SQLDriverConnect == NULL) {
		wcerr << L"Failed to load function: SQLDriverConnect";
	}
	_fn_SQLDriverConnectW = (_fn_SQLDriverConnectWType*) resolve("SQLDriverConnectW");
	if (_fn_SQLDriverConnectW == NULL) {
		wcerr << L"Failed to load function: SQLDriverConnectW";
	}
	_fn_SQLEndTran = (_fn_SQLEndTranType*) resolve("SQLEndTran");
	if (_fn_SQLEndTran == NULL) {
		wcerr << L"Failed to load function: SQLEndTran";
	}
	_fn_SQLExecDirect = (_fn_SQLExecDirectType*) resolve("SQLExecDirect");
	if (_fn_SQLExecDirect == NULL) {
		wcerr << L"Failed to load function: SQLExecDirect";
	}
	_fn_SQLExecDirectW = (_fn_SQLExecDirectWType*) resolve("SQLExecDirectW");
	if (_fn_SQLExecDirectW == NULL) {
		wcerr << L"Failed to load function: SQLExecDirectW";
	}
	_fn_SQLExecute = (_fn_SQLExecuteType*) resolve("SQLExecute");
	if (_fn_SQLExecute == NULL) {
		wcerr << L"Failed to load function: SQLExecute";
	}
	_fn_SQLFetch = (_fn_SQLFetchType*) resolve("SQLFetch");
	if (_fn_SQLFetch == NULL) {
		wcerr << L"Failed to load function: SQLFetch";
	}
	_fn_SQLFetchScroll = (_fn_SQLFetchScrollType*) resolve("SQLFetchScroll");
	if (_fn_SQLFetchScroll == NULL) {
		wcerr << L"Failed to load function: SQLFetchScroll";
	}
	_fn_SQLForeignKeys = (_fn_SQLForeignKeysType*) resolve("SQLForeignKeys");
	if (_fn_SQLForeignKeys == NULL) {
		wcerr << L"Failed to load function: SQLForeignKeys";
	}
	_fn_SQLForeignKeysW = (_fn_SQLForeignKeysWType*) resolve("SQLForeignKeysW");
	if (_fn_SQLForeignKeysW == NULL) {
		wcerr << L"Failed to load function: SQLForeignKeysW";
	}
	_fn_SQLFreeStmt = (_fn_SQLFreeStmtType*) resolve("SQLFreeStmt");
	if (_fn_SQLFreeStmt == NULL) {
		wcerr << L"Failed to load function: SQLFreeStmt";
	}
	_fn_SQLFreeHandle = (_fn_SQLFreeHandleType*) resolve("SQLFreeHandle");
	if (_fn_SQLFreeHandle == NULL) {
		wcerr << L"Failed to load function: SQLFreeHandle";
	}
	_fn_SQLGetConnectAttr = (_fn_SQLGetConnectAttrType*) resolve("SQLGetConnectAttr");
	if (_fn_SQLGetConnectAttr == NULL) {
		wcerr << L"Failed to load function: SQLGetConnectAttr";
	}
	_fn_SQLGetConnectAttrW = (_fn_SQLGetConnectAttrWType*) resolve("SQLGetConnectAttrW");
	if (_fn_SQLGetConnectAttrW == NULL) {
		wcerr << L"Failed to load function: SQLGetConnectAttrW";
	}
	_fn_SQLGetCursorName = (_fn_SQLGetCursorNameType*) resolve("SQLGetCursorName");
	if (_fn_SQLGetCursorName == NULL) {
		wcerr << L"Failed to load function: SQLGetCursorName";
	}
	_fn_SQLGetCursorNameW = (_fn_SQLGetCursorNameWType*) resolve("SQLGetCursorNameW");
	if (_fn_SQLGetCursorNameW == NULL) {
		wcerr << L"Failed to load function: SQLGetCursorNameW";
	}
	_fn_SQLGetData = (_fn_SQLGetDataType*) resolve("SQLGetData");
	if (_fn_SQLGetData == NULL) {
		wcerr << L"Failed to load function: SQLGetData";
	}
	_fn_SQLGetDescField = (_fn_SQLGetDescFieldType*) resolve("SQLGetDescField");
	if (_fn_SQLGetDescField == NULL) {
		wcerr << L"Failed to load function: SQLGetDescField";
	}
	_fn_SQLGetDescFieldW = (_fn_SQLGetDescFieldWType*) resolve("SQLGetDescFieldW");
	if (_fn_SQLGetDescFieldW == NULL) {
		wcerr << L"Failed to load function: SQLGetDescFieldW";
	}
	_fn_SQLGetDescRec = (_fn_SQLGetDescRecType*) resolve("SQLGetDescRec");
	if (_fn_SQLGetDescRec == NULL) {
		wcerr << L"Failed to load function: SQLGetDescRec";
	}
	_fn_SQLGetDescRecW = (_fn_SQLGetDescRecWType*) resolve("SQLGetDescRecW");
	if (_fn_SQLGetDescRecW == NULL) {
		wcerr << L"Failed to load function: SQLGetDescRecW";
	}
	_fn_SQLGetDiagField = (_fn_SQLGetDiagFieldType*) resolve("SQLGetDiagField");
	if (_fn_SQLGetDiagField == NULL) {
		wcerr << L"Failed to load function: SQLGetDiagField";
	}
	_fn_SQLGetDiagFieldW = (_fn_SQLGetDiagFieldWType*) resolve("SQLGetDiagFieldW");
	if (_fn_SQLGetDiagFieldW == NULL) {
		wcerr << L"Failed to load function: SQLGetDiagFieldW";
	}
	_fn_SQLGetDiagRec = (_fn_SQLGetDiagRecType*) resolve("SQLGetDiagRec");
	if (_fn_SQLGetDiagRec == NULL) {
		wcerr << L"Failed to load function: SQLGetDiagRec";
	}
	_fn_SQLGetDiagRecW = (_fn_SQLGetDiagRecWType*) resolve("SQLGetDiagRecW");
	if (_fn_SQLGetDiagRecW == NULL) {
		wcerr << L"Failed to load function: SQLGetDiagRecW";
	}
	_fn_SQLGetEnvAttr = (_fn_SQLGetEnvAttrType*) resolve("SQLGetEnvAttr");
	if (_fn_SQLGetEnvAttr == NULL) {
		wcerr << L"Failed to load function: SQLGetEnvAttr";
	}
	_fn_SQLGetInfo = (_fn_SQLGetInfoType*) resolve("SQLGetInfo");
	if (_fn_SQLGetInfo == NULL) {
		wcerr << L"Failed to load function: SQLGetInfo";
	}
	_fn_SQLGetInfoW = (_fn_SQLGetInfoWType*) resolve("SQLGetInfoW");
	if (_fn_SQLGetInfoW == NULL) {
		wcerr << L"Failed to load function: SQLGetInfoW";
	}
	_fn_SQLGetStmtAttr = (_fn_SQLGetStmtAttrType*) resolve("SQLGetStmtAttr");
	if (_fn_SQLGetStmtAttr == NULL) {
		wcerr << L"Failed to load function: SQLGetStmtAttr";
	}
	_fn_SQLGetStmtAttrW = (_fn_SQLGetStmtAttrWType*) resolve("SQLGetStmtAttrW");
	if (_fn_SQLGetStmtAttrW == NULL) {
		wcerr << L"Failed to load function: SQLGetStmtAttrW";
	}
	_fn_SQLGetTypeInfo = (_fn_SQLGetTypeInfoType*) resolve("SQLGetTypeInfo");
	if (_fn_SQLGetTypeInfo == NULL) {
		wcerr << L"Failed to load function: SQLGetTypeInfo";
	}
	_fn_SQLGetTypeInfoW = (_fn_SQLGetTypeInfoWType*) resolve("SQLGetTypeInfoW");
	if (_fn_SQLGetTypeInfoW == NULL) {
		wcerr << L"Failed to load function: SQLGetTypeInfoW";
	}
	_fn_SQLMoreResults = (_fn_SQLMoreResultsType*) resolve("SQLMoreResults");
	if (_fn_SQLMoreResults == NULL) {
		wcerr << L"Failed to load function: SQLMoreResults";
	}
	_fn_SQLNativeSql = (_fn_SQLNativeSqlType*) resolve("SQLNativeSql");
	if (_fn_SQLNativeSql == NULL) {
		wcerr << L"Failed to load function: SQLNativeSql";
	}
	_fn_SQLNativeSqlW = (_fn_SQLNativeSqlWType*) resolve("SQLNativeSqlW");
	if (_fn_SQLNativeSqlW == NULL) {
		wcerr << L"Failed to load function: SQLNativeSqlW";
	}
	_fn_SQLNumResultCols = (_fn_SQLNumResultColsType*) resolve("SQLNumResultCols");
	if (_fn_SQLNumResultCols == NULL) {
		wcerr << L"Failed to load function: SQLNumResultCols";
	}
	_fn_SQLParamData = (_fn_SQLParamDataType*) resolve("SQLParamData");
	if (_fn_SQLParamData == NULL) {
		wcerr << L"Failed to load function: SQLParamData";
	}
	_fn_SQLPrepare = (_fn_SQLPrepareType*) resolve("SQLPrepare");
	if (_fn_SQLPrepare == NULL) {
		wcerr << L"Failed to load function: SQLPrepare";
	}
	_fn_SQLPrepareW = (_fn_SQLPrepareWType*) resolve("SQLPrepareW");
	if (_fn_SQLPrepareW == NULL) {
		wcerr << L"Failed to load function: SQLPrepareW";
	}
	_fn_SQLPrimaryKeys = (_fn_SQLPrimaryKeysType*) resolve("SQLPrimaryKeys");
	if (_fn_SQLPrimaryKeys == NULL) {
		wcerr << L"Failed to load function: SQLPrimaryKeys";
	}
	_fn_SQLPrimaryKeysW = (_fn_SQLPrimaryKeysWType*) resolve("SQLPrimaryKeysW");
	if (_fn_SQLPrimaryKeysW == NULL) {
		wcerr << L"Failed to load function: SQLPrimaryKeysW";
	}
	_fn_SQLProcedureColumns = (_fn_SQLProcedureColumnsType*) resolve("SQLProcedureColumns");
	if (_fn_SQLProcedureColumns == NULL) {
		wcerr << L"Failed to load function: SQLProcedureColumns";
	}
	_fn_SQLProcedureColumnsW = (_fn_SQLProcedureColumnsWType*) resolve("SQLProcedureColumnsW");
	if (_fn_SQLProcedureColumnsW == NULL) {
		wcerr << L"Failed to load function: SQLProcedureColumnsW";
	}
	_fn_SQLProcedures = (_fn_SQLProceduresType*) resolve("SQLProcedures");
	if (_fn_SQLProcedures == NULL) {
		wcerr << L"Failed to load function: SQLProcedures";
	}
	_fn_SQLProceduresW = (_fn_SQLProceduresWType*) resolve("SQLProceduresW");
	if (_fn_SQLProceduresW == NULL) {
		wcerr << L"Failed to load function: SQLProceduresW";
	}
	_fn_SQLPutData = (_fn_SQLPutDataType*) resolve("SQLPutData");
	if (_fn_SQLPutData == NULL) {
		wcerr << L"Failed to load function: SQLPutData";
	}
	_fn_SQLRowCount = (_fn_SQLRowCountType*) resolve("SQLRowCount");
	if (_fn_SQLRowCount == NULL) {
		wcerr << L"Failed to load function: SQLRowCount";
	}
	_fn_SQLSetConnectAttr = (_fn_SQLSetConnectAttrType*) resolve("SQLSetConnectAttr");
	if (_fn_SQLSetConnectAttr == NULL) {
		wcerr << L"Failed to load function: SQLSetConnectAttr";
	}
	_fn_SQLSetConnectAttrW = (_fn_SQLSetConnectAttrWType*) resolve("SQLSetConnectAttrW");
	if (_fn_SQLSetConnectAttrW == NULL) {
		wcerr << L"Failed to load function: SQLSetConnectAttrW";
	}
	_fn_SQLSetCursorName = (_fn_SQLSetCursorNameType*) resolve("SQLSetCursorName");
	if (_fn_SQLSetCursorName == NULL) {
		wcerr << L"Failed to load function: SQLSetCursorName";
	}
	_fn_SQLSetCursorNameW = (_fn_SQLSetCursorNameWType*) resolve("SQLSetCursorNameW");
	if (_fn_SQLSetCursorNameW == NULL) {
		wcerr << L"Failed to load function: SQLSetCursorNameW";
	}
	_fn_SQLSetDescField = (_fn_SQLSetDescFieldType*) resolve("SQLSetDescField");
	if (_fn_SQLSetDescField == NULL) {
		wcerr << L"Failed to load function: SQLSetDescField";
	}
	_fn_SQLSetDescFieldW = (_fn_SQLSetDescFieldWType*) resolve("SQLSetDescFieldW");
	if (_fn_SQLSetDescFieldW == NULL) {
		wcerr << L"Failed to load function: SQLSetDescFieldW";
	}
	_fn_SQLSetDescRec = (_fn_SQLSetDescRecType*) resolve("SQLSetDescRec");
	if (_fn_SQLSetDescRec == NULL) {
		wcerr << L"Failed to load function: SQLSetDescRec";
	}
	_fn_SQLSetEnvAttr = (_fn_SQLSetEnvAttrType*) resolve("SQLSetEnvAttr");
	if (_fn_SQLSetEnvAttr == NULL) {
		wcerr << L"Failed to load function: SQLSetEnvAttr";
	}
	_fn_SQLSetPos = (_fn_SQLSetPosType*) resolve("SQLSetPos");
	if (_fn_SQLSetPos == NULL) {
		wcerr << L"Failed to load function: SQLSetPos";
	}
	_fn_SQLSetScrollOptions = (_fn_SQLSetScrollOptionsType*) resolve("SQLSetScrollOptions");
	if (_fn_SQLSetScrollOptions == NULL) {
		wcerr << L"Failed to load function: SQLSetScrollOptions";
	}
	_fn_SQLSetStmtAttr = (_fn_SQLSetStmtAttrType*) resolve("SQLSetStmtAttr");
	if (_fn_SQLSetStmtAttr == NULL) {
		wcerr << L"Failed to load function: SQLSetStmtAttr";
	}
	_fn_SQLSetStmtAttrW = (_fn_SQLSetStmtAttrWType*) resolve("SQLSetStmtAttrW");
	if (_fn_SQLSetStmtAttrW == NULL) {
		wcerr << L"Failed to load function: SQLSetStmtAttrW";
	}
	_fn_SQLSpecialColumns = (_fn_SQLSpecialColumnsType*) resolve("SQLSpecialColumns");
	if (_fn_SQLSpecialColumns == NULL) {
		wcerr << L"Failed to load function: SQLSpecialColumns";
	}
	_fn_SQLSpecialColumnsW = (_fn_SQLSpecialColumnsWType*) resolve("SQLSpecialColumnsW");
	if (_fn_SQLSpecialColumnsW == NULL) {
		wcerr << L"Failed to load function: SQLSpecialColumnsW";
	}
	_fn_SQLStatistics = (_fn_SQLStatisticsType*) resolve("SQLStatistics");
	if (_fn_SQLStatistics == NULL) {
		wcerr << L"Failed to load function: SQLStatistics";
	}
	_fn_SQLStatisticsW = (_fn_SQLStatisticsWType*) resolve("SQLStatisticsW");
	if (_fn_SQLStatisticsW == NULL) {
		wcerr << L"Failed to load function: SQLStatisticsW";
	}
	_fn_SQLTablePrivileges = (_fn_SQLTablePrivilegesType*) resolve("SQLTablePrivileges");
	if (_fn_SQLTablePrivileges == NULL) {
		wcerr << L"Failed to load function: SQLTablePrivileges";
	}
	_fn_SQLTablePrivilegesW = (_fn_SQLTablePrivilegesWType*) resolve("SQLTablePrivilegesW");
	if (_fn_SQLTablePrivilegesW == NULL) {
		wcerr << L"Failed to load function: SQLTablePrivilegesW";
	}
	_fn_SQLTables = (_fn_SQLTablesType*) resolve("SQLTables");
	if (_fn_SQLTables == NULL) {
		wcerr << L"Failed to load function: SQLTables";
	}
	_fn_SQLTablesW = (_fn_SQLTablesWType*) resolve("SQLTablesW");
	if (_fn_SQLTablesW == NULL) {
		wcerr << L"Failed to load function: SQLTablesW";
	}
	_fn_SQLTransact = (_fn_SQLTransactType*) resolve("SQLTransact");
	if (_fn_SQLTransact == NULL) {
		wcerr << L"Failed to load function: SQLTransact";
	}
	// Function lookup END - generated code

    initDone = true;

    return true;
}

void *ODBCWrapper::resolve(const char *functionName) {
	void * ret = odbcLib->get_function(functionName);
	if (ret==NULL) {
		cerr << "Failed to resolve function " << functionName << endl;
	}
	return ret;
}


//// ODBC FUNCTIONS - generated code /////
SQLRETURN SQL_API ODBCWrapper::SQLAllocHandle(SQLSMALLINT HandleType, SQLHANDLE InputHandle, __out SQLHANDLE *OutputHandle)  {
	if (_fn_SQLAllocHandle==NULL) {
		wcerr << "NULL function pointer for SQLAllocHandle";
		return SQL_ERROR;
	}
	return _fn_SQLAllocHandle(HandleType, InputHandle, OutputHandle);
}

SQLRETURN SQL_API ODBCWrapper::SQLBindCol(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType, __inout_xcount_opt(BufferLength) SQLPOINTER TargetValue, SQLLEN BufferLength, __inout_opt SQLLEN *StrLen_or_Ind)  {
	if (_fn_SQLBindCol==NULL) {
		wcerr << "NULL function pointer for SQLBindCol";
		return SQL_ERROR;
	}
	return _fn_SQLBindCol(StatementHandle, ColumnNumber, TargetType, TargetValue, BufferLength, StrLen_or_Ind);
}

SQLRETURN SQL_API ODBCWrapper::SQLBindParameter( SQLHSTMT           hstmt, SQLUSMALLINT       ipar, SQLSMALLINT        fParamType, SQLSMALLINT        fCType, SQLSMALLINT        fSqlType, SQLULEN            cbColDef, SQLSMALLINT        ibScale, SQLPOINTER         rgbValue, SQLLEN             cbValueMax, SQLLEN             *pcbValue)  {
	if (_fn_SQLBindParameter==NULL) {
		wcerr << "NULL function pointer for SQLBindParameter";
		return SQL_ERROR;
	}
	return _fn_SQLBindParameter(hstmt, ipar, fParamType, fCType, fSqlType, cbColDef, ibScale, rgbValue, cbValueMax, pcbValue);
}

SQLRETURN SQL_API ODBCWrapper::SQLBrowseConnect( SQLHDBC            hdbc, __in_ecount(cchConnStrIn) SQLCHAR           *szConnStrIn, SQLSMALLINT        cchConnStrIn, __out_ecount_opt(cchConnStrOutMax) SQLCHAR           *szConnStrOut, SQLSMALLINT        cchConnStrOutMax, __out_opt SQLSMALLINT       *pcchConnStrOut)  {
	if (_fn_SQLBrowseConnect==NULL) {
		wcerr << "NULL function pointer for SQLBrowseConnect";
		return SQL_ERROR;
	}
	return _fn_SQLBrowseConnect(hdbc, szConnStrIn, cchConnStrIn, szConnStrOut, cchConnStrOutMax, pcchConnStrOut);
}

SQLRETURN SQL_API ODBCWrapper::SQLBrowseConnectW ( SQLHDBC             hdbc, __in_ecount(cchConnStrIn) SQLWCHAR* szConnStrIn, SQLSMALLINT         cchConnStrIn, __out_ecount_opt(cchConnStrOutMax) SQLWCHAR* szConnStrOut, SQLSMALLINT         cchConnStrOutMax, __out_opt SQLSMALLINT*        pcchConnStrOut )  {
	if (_fn_SQLBrowseConnectW ==NULL) {
		wcerr << "NULL function pointer for SQLBrowseConnectW ";
		return SQL_ERROR;
	}
	return _fn_SQLBrowseConnectW (hdbc, szConnStrIn, cchConnStrIn, szConnStrOut, cchConnStrOutMax, pcchConnStrOut);
}

SQLRETURN SQL_API ODBCWrapper::SQLBulkOperations( SQLHSTMT            StatementHandle, SQLSMALLINT         Operation)  {
	if (_fn_SQLBulkOperations==NULL) {
		wcerr << "NULL function pointer for SQLBulkOperations";
		return SQL_ERROR;
	}
	return _fn_SQLBulkOperations(StatementHandle, Operation);
}

SQLRETURN SQL_API ODBCWrapper::SQLCancel(SQLHSTMT StatementHandle)  {
	if (_fn_SQLCancel==NULL) {
		wcerr << "NULL function pointer for SQLCancel";
		return SQL_ERROR;
	}
	return _fn_SQLCancel(StatementHandle);
}

SQLRETURN SQL_API ODBCWrapper::SQLCloseCursor(SQLHSTMT StatementHandle)  {
	if (_fn_SQLCloseCursor==NULL) {
		wcerr << "NULL function pointer for SQLCloseCursor";
		return SQL_ERROR;
	}
	return _fn_SQLCloseCursor(StatementHandle);
}

#ifdef _WIN64
SQLRETURN SQL_API ODBCWrapper::SQLColAttribute (SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLUSMALLINT FieldIdentifier, __out_bcount_opt(BufferLength) SQLPOINTER CharacterAttribute, SQLSMALLINT BufferLength, __out_opt SQLSMALLINT *StringLength, __out_opt SQLLEN *NumericAttribute)  {
	if (_fn_SQLColAttribute ==NULL) {
		wcerr << "NULL function pointer for SQLColAttribute ";
		return SQL_ERROR;
	}
	return _fn_SQLColAttribute (StatementHandle, ColumnNumber, FieldIdentifier, CharacterAttribute, BufferLength, StringLength, NumericAttribute);
}

SQLRETURN SQL_API ODBCWrapper::SQLColAttributeW ( SQLHSTMT        hstmt, SQLUSMALLINT    iCol, SQLUSMALLINT    iField, __out_bcount_opt(cbDescMax) SQLPOINTER      pCharAttr, SQLSMALLINT     cbDescMax, __out_opt SQLSMALLINT     *pcbCharAttr, __out_opt SQLLEN          *pNumAttr )  {
	if (_fn_SQLColAttributeW ==NULL) {
		wcerr << "NULL function pointer for SQLColAttributeW ";
		return SQL_ERROR;
	}
	return _fn_SQLColAttributeW (hstmt, iCol, iField, pCharAttr, cbDescMax, pcbCharAttr, pNumAttr);
}

#else
SQLRETURN SQL_API ODBCWrapper::SQLColAttribute (SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLUSMALLINT FieldIdentifier, __out_bcount_opt(BufferLength) SQLPOINTER CharacterAttribute, SQLSMALLINT BufferLength, __out_opt SQLSMALLINT *StringLength, __out_opt SQLPOINTER NumericAttribute)  {
	if (_fn_SQLColAttribute ==NULL) {
		wcerr << "NULL function pointer for SQLColAttribute ";
		return SQL_ERROR;
	}
	return _fn_SQLColAttribute (StatementHandle, ColumnNumber, FieldIdentifier, CharacterAttribute, BufferLength, StringLength, NumericAttribute);
}

SQLRETURN SQL_API ODBCWrapper::SQLColAttributeW( SQLHSTMT        hstmt, SQLUSMALLINT    iCol, SQLUSMALLINT    iField, __out_bcount_opt(cbDescMax) SQLPOINTER      pCharAttr, SQLSMALLINT     cbDescMax, __out_opt SQLSMALLINT     *pcbCharAttr, __out_opt SQLPOINTER      pNumAttr)  {
	if (_fn_SQLColAttributeW==NULL) {
		wcerr << "NULL function pointer for SQLColAttributeW";
		return SQL_ERROR;
	}
	return _fn_SQLColAttributeW(hstmt, iCol, iField, pCharAttr, cbDescMax, pcbCharAttr, pNumAttr);
}

#endif
SQLRETURN SQL_API ODBCWrapper::SQLColumnPrivileges( SQLHSTMT           hstmt, __in_ecount_opt(cchCatalogName) SQLCHAR           *szCatalogName, SQLSMALLINT        cchCatalogName, __in_ecount_opt(cchSchemaName) SQLCHAR           *szSchemaName, SQLSMALLINT        cchSchemaName, __in_ecount_opt(cchTableName) SQLCHAR           *szTableName, SQLSMALLINT        cchTableName, __in_ecount_opt(cchColumnName) SQLCHAR           *szColumnName, SQLSMALLINT        cchColumnName)  {
	if (_fn_SQLColumnPrivileges==NULL) {
		wcerr << "NULL function pointer for SQLColumnPrivileges";
		return SQL_ERROR;
	}
	return _fn_SQLColumnPrivileges(hstmt, szCatalogName, cchCatalogName, szSchemaName, cchSchemaName, szTableName, cchTableName, szColumnName, cchColumnName);
}

SQLRETURN SQL_API ODBCWrapper::SQLColumnPrivilegesW( SQLHSTMT           hstmt, __in_ecount_opt(cchCatalogName) SQLWCHAR*    szCatalogName, SQLSMALLINT        cchCatalogName, __in_ecount_opt(cchSchemaName) SQLWCHAR*     szSchemaName, SQLSMALLINT        cchSchemaName, __in_ecount_opt(cchTableName) SQLWCHAR*      szTableName, SQLSMALLINT        cchTableName, __in_ecount_opt(cchColumnName) SQLWCHAR*     szColumnName, SQLSMALLINT        cchColumnName )  {
	if (_fn_SQLColumnPrivilegesW==NULL) {
		wcerr << "NULL function pointer for SQLColumnPrivilegesW";
		return SQL_ERROR;
	}
	return _fn_SQLColumnPrivilegesW(hstmt, szCatalogName, cchCatalogName, szSchemaName, cchSchemaName, szTableName, cchTableName, szColumnName, cchColumnName);
}

SQLRETURN SQL_API ODBCWrapper::SQLColumns(SQLHSTMT StatementHandle, __in_ecount_opt(NameLength1) SQLCHAR *CatalogName, SQLSMALLINT NameLength1, __in_ecount_opt(NameLength2) SQLCHAR *SchemaName, SQLSMALLINT NameLength2, __in_ecount_opt(NameLength3) SQLCHAR *TableName, SQLSMALLINT NameLength3, __in_ecount_opt(NameLength4) SQLCHAR *ColumnName, SQLSMALLINT NameLength4)  {
	if (_fn_SQLColumns==NULL) {
		wcerr << "NULL function pointer for SQLColumns";
		return SQL_ERROR;
	}
	return _fn_SQLColumns(StatementHandle, CatalogName, NameLength1, SchemaName, NameLength2, TableName, NameLength3, ColumnName, NameLength4);
}

SQLRETURN SQL_API ODBCWrapper::SQLColumnsW ( SQLHSTMT           hstmt, __in_ecount_opt(cchCatalogName) SQLWCHAR*    szCatalogName, SQLSMALLINT        cchCatalogName, __in_ecount_opt(cchSchemaName) SQLWCHAR*     szSchemaName, SQLSMALLINT        cchSchemaName, __in_ecount_opt(cchTableName) SQLWCHAR*      szTableName, SQLSMALLINT        cchTableName, __in_ecount_opt(cchColumnName) SQLWCHAR*     szColumnName, SQLSMALLINT        cchColumnName )  {
	if (_fn_SQLColumnsW ==NULL) {
		wcerr << "NULL function pointer for SQLColumnsW ";
		return SQL_ERROR;
	}
	return _fn_SQLColumnsW (hstmt, szCatalogName, cchCatalogName, szSchemaName, cchSchemaName, szTableName, cchTableName, szColumnName, cchColumnName);
}

SQLRETURN SQL_API ODBCWrapper::SQLConnect(SQLHDBC ConnectionHandle, __in_ecount(NameLength1) SQLCHAR *ServerName, SQLSMALLINT NameLength1, __in_ecount(NameLength2) SQLCHAR *UserName, SQLSMALLINT NameLength2, __in_ecount(NameLength3) SQLCHAR *Authentication, SQLSMALLINT NameLength3)  {
	if (_fn_SQLConnect==NULL) {
		wcerr << "NULL function pointer for SQLConnect";
		return SQL_ERROR;
	}
	return _fn_SQLConnect(ConnectionHandle, ServerName, NameLength1, UserName, NameLength2, Authentication, NameLength3);
}

SQLRETURN SQL_API ODBCWrapper::SQLConnectW ( SQLHDBC             hdbc, __in_ecount(cchDSN) SQLWCHAR* szDSN, SQLSMALLINT         cchDSN, __in_ecount(cchUID) SQLWCHAR* szUID, SQLSMALLINT         cchUID, __in_ecount(cchAuthStr) SQLWCHAR* szAuthStr, SQLSMALLINT         cchAuthStr )  {
	if (_fn_SQLConnectW ==NULL) {
		wcerr << "NULL function pointer for SQLConnectW ";
		return SQL_ERROR;
	}
	return _fn_SQLConnectW (hdbc, szDSN, cchDSN, szUID, cchUID, szAuthStr, cchAuthStr);
}

SQLRETURN SQL_API ODBCWrapper::SQLCopyDesc(SQLHDESC SourceDescHandle, SQLHDESC TargetDescHandle)  {
	if (_fn_SQLCopyDesc==NULL) {
		wcerr << "NULL function pointer for SQLCopyDesc";
		return SQL_ERROR;
	}
	return _fn_SQLCopyDesc(SourceDescHandle, TargetDescHandle);
}

SQLRETURN SQL_API ODBCWrapper::SQLDescribeCol(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, __out_ecount_opt(BufferLength) SQLCHAR *ColumnName, SQLSMALLINT BufferLength, __out_opt SQLSMALLINT *NameLength, __out_opt SQLSMALLINT *DataType, __out_opt SQLULEN *ColumnSize, __out_opt SQLSMALLINT *DecimalDigits, __out_opt SQLSMALLINT *Nullable)  {
	if (_fn_SQLDescribeCol==NULL) {
		wcerr << "NULL function pointer for SQLDescribeCol";
		return SQL_ERROR;
	}
	return _fn_SQLDescribeCol(StatementHandle, ColumnNumber, ColumnName, BufferLength, NameLength, DataType, ColumnSize, DecimalDigits, Nullable);
}

SQLRETURN SQL_API ODBCWrapper::SQLDescribeColW ( SQLHSTMT            hstmt, SQLUSMALLINT        icol, __out_ecount_opt(cchColNameMax) SQLWCHAR* szColName, SQLSMALLINT         cchColNameMax, __out_opt SQLSMALLINT*        pcchColName, __out_opt SQLSMALLINT*        pfSqlType, __out_opt SQLULEN*            pcbColDef, __out_opt SQLSMALLINT*        pibScale, __out_opt SQLSMALLINT*        pfNullable )  {
	if (_fn_SQLDescribeColW ==NULL) {
		wcerr << "NULL function pointer for SQLDescribeColW ";
		return SQL_ERROR;
	}
	return _fn_SQLDescribeColW (hstmt, icol, szColName, cchColNameMax, pcchColName, pfSqlType, pcbColDef, pibScale, pfNullable);
}

SQLRETURN SQL_API ODBCWrapper::SQLDescribeParam( SQLHSTMT           hstmt, SQLUSMALLINT       ipar, __out_opt SQLSMALLINT       *pfSqlType, __out_opt SQLULEN           *pcbParamDef, __out_opt SQLSMALLINT       *pibScale, __out_opt SQLSMALLINT       *pfNullable)  {
	if (_fn_SQLDescribeParam==NULL) {
		wcerr << "NULL function pointer for SQLDescribeParam";
		return SQL_ERROR;
	}
	return _fn_SQLDescribeParam(hstmt, ipar, pfSqlType, pcbParamDef, pibScale, pfNullable);
}

SQLRETURN SQL_API ODBCWrapper::SQLDisconnect(SQLHDBC ConnectionHandle)  {
	if (_fn_SQLDisconnect==NULL) {
		wcerr << "NULL function pointer for SQLDisconnect";
		return SQL_ERROR;
	}
	return _fn_SQLDisconnect(ConnectionHandle);
}

SQLRETURN SQL_API ODBCWrapper::SQLDriverConnect( SQLHDBC            hdbc, SQLHWND            hwnd, __in_ecount(cchConnStrIn) SQLCHAR           *szConnStrIn, SQLSMALLINT        cchConnStrIn, __out_ecount_opt(cchConnStrOutMax) SQLCHAR           *szConnStrOut, SQLSMALLINT        cchConnStrOutMax, __out_opt SQLSMALLINT       *pcchConnStrOut, SQLUSMALLINT       fDriverCompletion)  {
	if (_fn_SQLDriverConnect==NULL) {
		wcerr << "NULL function pointer for SQLDriverConnect";
		return SQL_ERROR;
	}
	return _fn_SQLDriverConnect(hdbc, hwnd, szConnStrIn, cchConnStrIn, szConnStrOut, cchConnStrOutMax, pcchConnStrOut, fDriverCompletion);
}

SQLRETURN SQL_API ODBCWrapper::SQLDriverConnectW ( SQLHDBC             hdbc, SQLHWND             hwnd, __in_ecount(cchConnStrIn) SQLWCHAR* szConnStrIn, SQLSMALLINT         cchConnStrIn, __out_ecount_opt(cchConnStrOutMax) SQLWCHAR* szConnStrOut, SQLSMALLINT         cchConnStrOutMax, __out_opt SQLSMALLINT*        pcchConnStrOut, SQLUSMALLINT        fDriverCompletion )  {
	if (_fn_SQLDriverConnectW ==NULL) {
		wcerr << "NULL function pointer for SQLDriverConnectW ";
		return SQL_ERROR;
	}
	return _fn_SQLDriverConnectW (hdbc, hwnd, szConnStrIn, cchConnStrIn, szConnStrOut, cchConnStrOutMax, pcchConnStrOut, fDriverCompletion);
}

SQLRETURN SQL_API ODBCWrapper::SQLEndTran(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT CompletionType)  {
	if (_fn_SQLEndTran==NULL) {
		wcerr << "NULL function pointer for SQLEndTran";
		return SQL_ERROR;
	}
	return _fn_SQLEndTran(HandleType, Handle, CompletionType);
}

SQLRETURN SQL_API ODBCWrapper::SQLExecDirect ( SQLHSTMT StatementHandle, __in_ecount_opt(TextLength) SQLCHAR* StatementText, SQLINTEGER TextLength )  {
	if (_fn_SQLExecDirect ==NULL) {
		wcerr << "NULL function pointer for SQLExecDirect ";
		return SQL_ERROR;
	}
	return _fn_SQLExecDirect (StatementHandle, StatementText, TextLength);
}

SQLRETURN SQL_API ODBCWrapper::SQLExecDirectW ( SQLHSTMT    hstmt, __in_ecount_opt(TextLength) SQLWCHAR* szSqlStr, SQLINTEGER  TextLength )  {
	if (_fn_SQLExecDirectW ==NULL) {
		wcerr << "NULL function pointer for SQLExecDirectW ";
		return SQL_ERROR;
	}
	return _fn_SQLExecDirectW (hstmt, szSqlStr, TextLength);
}

SQLRETURN SQL_API ODBCWrapper::SQLExecute(SQLHSTMT StatementHandle)  {
	if (_fn_SQLExecute==NULL) {
		wcerr << "NULL function pointer for SQLExecute";
		return SQL_ERROR;
	}
	return _fn_SQLExecute(StatementHandle);
}

SQLRETURN SQL_API ODBCWrapper::SQLFetch(SQLHSTMT StatementHandle)  {
	if (_fn_SQLFetch==NULL) {
		wcerr << "NULL function pointer for SQLFetch";
		return SQL_ERROR;
	}
	return _fn_SQLFetch(StatementHandle);
}

SQLRETURN SQL_API ODBCWrapper::SQLFetchScroll(SQLHSTMT StatementHandle, SQLSMALLINT FetchOrientation, SQLLEN FetchOffset)  {
	if (_fn_SQLFetchScroll==NULL) {
		wcerr << "NULL function pointer for SQLFetchScroll";
		return SQL_ERROR;
	}
	return _fn_SQLFetchScroll(StatementHandle, FetchOrientation, FetchOffset);
}

SQLRETURN SQL_API ODBCWrapper::SQLForeignKeys( SQLHSTMT           hstmt, __in_ecount_opt(cchPkCatalogName) SQLCHAR           *szPkCatalogName, SQLSMALLINT        cchPkCatalogName, __in_ecount_opt(cchPkSchemaName) SQLCHAR           *szPkSchemaName, SQLSMALLINT        cchPkSchemaName, __in_ecount_opt(cchPkTableName) SQLCHAR           *szPkTableName, SQLSMALLINT        cchPkTableName, __in_ecount_opt(cchFkCatalogName) SQLCHAR           *szFkCatalogName, SQLSMALLINT        cchFkCatalogName, __in_ecount_opt(cchFkSchemaName) SQLCHAR           *szFkSchemaName, SQLSMALLINT        cchFkSchemaName, __in_ecount_opt(cchFkTableName) SQLCHAR           *szFkTableName, SQLSMALLINT        cchFkTableName)  {
	if (_fn_SQLForeignKeys==NULL) {
		wcerr << "NULL function pointer for SQLForeignKeys";
		return SQL_ERROR;
	}
	return _fn_SQLForeignKeys(hstmt, szPkCatalogName, cchPkCatalogName, szPkSchemaName, cchPkSchemaName, szPkTableName, cchPkTableName, szFkCatalogName, cchFkCatalogName, szFkSchemaName, cchFkSchemaName, szFkTableName, cchFkTableName);
}

SQLRETURN SQL_API ODBCWrapper::SQLForeignKeysW ( SQLHSTMT           hstmt, __in_ecount_opt(cchPkCatalogName) SQLWCHAR*    szPkCatalogName, SQLSMALLINT        cchPkCatalogName, __in_ecount_opt(cchPkSchemaName) SQLWCHAR*     szPkSchemaName, SQLSMALLINT        cchPkSchemaName, __in_ecount_opt(cchPkTableName) SQLWCHAR*      szPkTableName, SQLSMALLINT        cchPkTableName, __in_ecount_opt(cchFkCatalogName) SQLWCHAR*    szFkCatalogName, SQLSMALLINT        cchFkCatalogName, __in_ecount_opt(cchFkSchemaName) SQLWCHAR*     szFkSchemaName, SQLSMALLINT        cchFkSchemaName, __in_ecount_opt(cchFkTableName) SQLWCHAR*      szFkTableName, SQLSMALLINT        cchFkTableName )  {
	if (_fn_SQLForeignKeysW ==NULL) {
		wcerr << "NULL function pointer for SQLForeignKeysW ";
		return SQL_ERROR;
	}
	return _fn_SQLForeignKeysW (hstmt, szPkCatalogName, cchPkCatalogName, szPkSchemaName, cchPkSchemaName, szPkTableName, cchPkTableName, szFkCatalogName, cchFkCatalogName, szFkSchemaName, cchFkSchemaName, szFkTableName, cchFkTableName);
}

SQLRETURN SQL_API ODBCWrapper::SQLFreeStmt(SQLHSTMT StatementHandle, SQLUSMALLINT Option)  {
	if (_fn_SQLFreeStmt==NULL) {
		wcerr << "NULL function pointer for SQLFreeStmt";
		return SQL_ERROR;
	}
	return _fn_SQLFreeStmt(StatementHandle, Option);
}

SQLRETURN SQL_API ODBCWrapper::SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle)  {
	if (_fn_SQLFreeHandle==NULL) {
		wcerr << "NULL function pointer for SQLFreeHandle";
		return SQL_ERROR;
	}
	return _fn_SQLFreeHandle(HandleType, Handle);
}

SQLRETURN SQL_API ODBCWrapper::SQLGetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, __out_xcount_opt(BufferLength) SQLPOINTER Value, SQLINTEGER BufferLength, __out_opt SQLINTEGER *StringLengthPtr)  {
	if (_fn_SQLGetConnectAttr==NULL) {
		wcerr << "NULL function pointer for SQLGetConnectAttr";
		return SQL_ERROR;
	}
	return _fn_SQLGetConnectAttr(ConnectionHandle, Attribute, Value, BufferLength, StringLengthPtr);
}

SQLRETURN SQL_API ODBCWrapper::SQLGetConnectAttrW ( SQLHDBC     hdbc, SQLINTEGER  fAttribute, __out_xcount_opt(cbValueMax) SQLPOINTER  rgbValue, SQLINTEGER  cbValueMax, __out_opt SQLINTEGER* pcbValue )  {
	if (_fn_SQLGetConnectAttrW ==NULL) {
		wcerr << "NULL function pointer for SQLGetConnectAttrW ";
		return SQL_ERROR;
	}
	return _fn_SQLGetConnectAttrW (hdbc, fAttribute, rgbValue, cbValueMax, pcbValue);
}

SQLRETURN SQL_API ODBCWrapper::SQLGetCursorName ( SQLHSTMT StatementHandle, __out_ecount_opt(BufferLength) SQLCHAR *CursorName, SQLSMALLINT BufferLength, __out_opt SQLSMALLINT *NameLengthPtr )  {
	if (_fn_SQLGetCursorName ==NULL) {
		wcerr << "NULL function pointer for SQLGetCursorName ";
		return SQL_ERROR;
	}
	return _fn_SQLGetCursorName (StatementHandle, CursorName, BufferLength, NameLengthPtr);
}

SQLRETURN SQL_API ODBCWrapper::SQLGetCursorNameW ( SQLHSTMT        hstmt, __out_ecount_opt(cchCursorMax) SQLWCHAR* szCursor, SQLSMALLINT     cchCursorMax, __out_opt SQLSMALLINT*    pcchCursor )  {
	if (_fn_SQLGetCursorNameW ==NULL) {
		wcerr << "NULL function pointer for SQLGetCursorNameW ";
		return SQL_ERROR;
	}
	return _fn_SQLGetCursorNameW (hstmt, szCursor, cchCursorMax, pcchCursor);
}

SQLRETURN SQL_API ODBCWrapper::SQLGetData(SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType, __out_xcount_opt(BufferLength) SQLPOINTER TargetValue, SQLLEN BufferLength, __out_opt SQLLEN *StrLen_or_IndPtr)  {
	if (_fn_SQLGetData==NULL) {
		wcerr << "NULL function pointer for SQLGetData";
		return SQL_ERROR;
	}
	return _fn_SQLGetData(StatementHandle, ColumnNumber, TargetType, TargetValue, BufferLength, StrLen_or_IndPtr);
}

SQLRETURN SQL_API ODBCWrapper::SQLGetDescField(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier, __out_xcount_opt(BufferLength) SQLPOINTER Value, SQLINTEGER BufferLength, __out_opt SQLINTEGER *StringLength)  {
	if (_fn_SQLGetDescField==NULL) {
		wcerr << "NULL function pointer for SQLGetDescField";
		return SQL_ERROR;
	}
	return _fn_SQLGetDescField(DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength, StringLength);
}

SQLRETURN SQL_API ODBCWrapper::SQLGetDescFieldW ( SQLHDESC        hdesc, SQLSMALLINT     iRecord, SQLSMALLINT     iField, __out_xcount_opt(cbBufferLength) SQLPOINTER      rgbValue, SQLINTEGER      cbBufferLength, __out_opt SQLINTEGER      *StringLength )  {
	if (_fn_SQLGetDescFieldW ==NULL) {
		wcerr << "NULL function pointer for SQLGetDescFieldW ";
		return SQL_ERROR;
	}
	return _fn_SQLGetDescFieldW (hdesc, iRecord, iField, rgbValue, cbBufferLength, StringLength);
}

SQLRETURN SQL_API ODBCWrapper::SQLGetDescRec(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, __out_ecount_opt(BufferLength) SQLCHAR *Name, SQLSMALLINT BufferLength, __out_opt SQLSMALLINT *StringLengthPtr, __out_opt SQLSMALLINT *TypePtr, __out_opt SQLSMALLINT *SubTypePtr, __out_opt SQLLEN     *LengthPtr, __out_opt SQLSMALLINT *PrecisionPtr, __out_opt SQLSMALLINT *ScalePtr, __out_opt SQLSMALLINT *NullablePtr)  {
	if (_fn_SQLGetDescRec==NULL) {
		wcerr << "NULL function pointer for SQLGetDescRec";
		return SQL_ERROR;
	}
	return _fn_SQLGetDescRec(DescriptorHandle, RecNumber, Name, BufferLength, StringLengthPtr, TypePtr, SubTypePtr, LengthPtr, PrecisionPtr, ScalePtr, NullablePtr);
}

SQLRETURN SQL_API ODBCWrapper::SQLGetDescRecW ( SQLHDESC        hdesc, SQLSMALLINT     iRecord, __out_ecount_opt(cchNameMax) SQLWCHAR* szName, SQLSMALLINT     cchNameMax, __out_opt SQLSMALLINT     *pcchName, __out_opt SQLSMALLINT     *pfType, __out_opt SQLSMALLINT     *pfSubType, __out_opt SQLLEN          *pLength, __out_opt SQLSMALLINT     *pPrecision, __out_opt SQLSMALLINT     *pScale, __out_opt SQLSMALLINT     *pNullable )  {
	if (_fn_SQLGetDescRecW ==NULL) {
		wcerr << "NULL function pointer for SQLGetDescRecW ";
		return SQL_ERROR;
	}
	return _fn_SQLGetDescRecW (hdesc, iRecord, szName, cchNameMax, pcchName, pfType, pfSubType, pLength, pPrecision, pScale, pNullable);
}

SQLRETURN SQL_API ODBCWrapper::SQLGetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber, SQLSMALLINT DiagIdentifier, __out_xcount_opt(BufferLength) SQLPOINTER DiagInfo, SQLSMALLINT BufferLength, __out_opt SQLSMALLINT *StringLength)  {
	if (_fn_SQLGetDiagField==NULL) {
		wcerr << "NULL function pointer for SQLGetDiagField";
		return SQL_ERROR;
	}
	return _fn_SQLGetDiagField(HandleType, Handle, RecNumber, DiagIdentifier, DiagInfo, BufferLength, StringLength);
}

SQLRETURN SQL_API ODBCWrapper::SQLGetDiagFieldW ( SQLSMALLINT     fHandleType, SQLHANDLE       handle, SQLSMALLINT     iRecord, SQLSMALLINT     fDiagField, __out_xcount_opt(cbBufferLength) SQLPOINTER      rgbDiagInfo, SQLSMALLINT     cbBufferLength, __out_opt SQLSMALLINT     *pcbStringLength )  {
	if (_fn_SQLGetDiagFieldW ==NULL) {
		wcerr << "NULL function pointer for SQLGetDiagFieldW ";
		return SQL_ERROR;
	}
	return _fn_SQLGetDiagFieldW (fHandleType, handle, iRecord, fDiagField, rgbDiagInfo, cbBufferLength, pcbStringLength);
}

SQLRETURN SQL_API ODBCWrapper::SQLGetDiagRec ( SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT RecNumber, __out_ecount_opt(6) SQLCHAR *Sqlstate, SQLINTEGER *NativeError, __out_ecount_opt(BufferLength) SQLCHAR* MessageText, SQLSMALLINT BufferLength, __out_opt SQLSMALLINT *TextLength )  {
	if (_fn_SQLGetDiagRec ==NULL) {
		wcerr << "NULL function pointer for SQLGetDiagRec ";
		return SQL_ERROR;
	}
	return _fn_SQLGetDiagRec (HandleType, Handle, RecNumber, Sqlstate, NativeError, MessageText, BufferLength, TextLength);
}

SQLRETURN SQL_API ODBCWrapper::SQLGetDiagRecW ( SQLSMALLINT     fHandleType, SQLHANDLE       handle, SQLSMALLINT     iRecord, __out_ecount_opt(6) SQLWCHAR* szSqlState, SQLINTEGER*     pfNativeError, __out_ecount_opt(cchErrorMsgMax) SQLWCHAR* szErrorMsg, SQLSMALLINT     cchErrorMsgMax, SQLSMALLINT*    pcchErrorMsg )  {
	if (_fn_SQLGetDiagRecW ==NULL) {
		wcerr << "NULL function pointer for SQLGetDiagRecW ";
		return SQL_ERROR;
	}
	return _fn_SQLGetDiagRecW (fHandleType, handle, iRecord, szSqlState, pfNativeError, szErrorMsg, cchErrorMsgMax, pcchErrorMsg);
}

SQLRETURN SQL_API ODBCWrapper::SQLGetEnvAttr(SQLHENV EnvironmentHandle, SQLINTEGER Attribute, __out_xcount(BufferLength) SQLPOINTER Value, SQLINTEGER BufferLength, __out_opt SQLINTEGER *StringLength)  {
	if (_fn_SQLGetEnvAttr==NULL) {
		wcerr << "NULL function pointer for SQLGetEnvAttr";
		return SQL_ERROR;
	}
	return _fn_SQLGetEnvAttr(EnvironmentHandle, Attribute, Value, BufferLength, StringLength);
}

SQLRETURN SQL_API ODBCWrapper::SQLGetInfo(SQLHDBC ConnectionHandle, SQLUSMALLINT InfoType, __out_bcount_opt(BufferLength) SQLPOINTER InfoValue, SQLSMALLINT BufferLength, __out_opt SQLSMALLINT *StringLengthPtr)  {
	if (_fn_SQLGetInfo==NULL) {
		wcerr << "NULL function pointer for SQLGetInfo";
		return SQL_ERROR;
	}
	return _fn_SQLGetInfo(ConnectionHandle, InfoType, InfoValue, BufferLength, StringLengthPtr);
}

SQLRETURN SQL_API ODBCWrapper::SQLGetInfoW( SQLHDBC                     hdbc, SQLUSMALLINT                fInfoType, __out_bcount_opt(cbInfoValueMax) SQLPOINTER rgbInfoValue, SQLSMALLINT        cbInfoValueMax, __out_opt SQLSMALLINT*                pcbInfoValue)  {
	if (_fn_SQLGetInfoW==NULL) {
		wcerr << "NULL function pointer for SQLGetInfoW";
		return SQL_ERROR;
	}
	return _fn_SQLGetInfoW(hdbc, fInfoType, rgbInfoValue, cbInfoValueMax, pcbInfoValue);
}

SQLRETURN SQL_API ODBCWrapper::SQLGetStmtAttr(SQLHSTMT StatementHandle, SQLINTEGER Attribute, __out_xcount_opt(BufferLength) SQLPOINTER Value, SQLINTEGER BufferLength, __out_opt SQLINTEGER *StringLength)  {
	if (_fn_SQLGetStmtAttr==NULL) {
		wcerr << "NULL function pointer for SQLGetStmtAttr";
		return SQL_ERROR;
	}
	return _fn_SQLGetStmtAttr(StatementHandle, Attribute, Value, BufferLength, StringLength);
}

SQLRETURN SQL_API ODBCWrapper::SQLGetStmtAttrW( SQLHSTMT           hstmt, SQLINTEGER         fAttribute, SQLPOINTER         rgbValue, SQLINTEGER         cbValueMax, SQLINTEGER     *pcbValue)  {
	if (_fn_SQLGetStmtAttrW==NULL) {
		wcerr << "NULL function pointer for SQLGetStmtAttrW";
		return SQL_ERROR;
	}
	return _fn_SQLGetStmtAttrW(hstmt, fAttribute, rgbValue, cbValueMax, pcbValue);
}

SQLRETURN SQL_API ODBCWrapper::SQLGetTypeInfo(SQLHSTMT StatementHandle, SQLSMALLINT DataType)  {
	if (_fn_SQLGetTypeInfo==NULL) {
		wcerr << "NULL function pointer for SQLGetTypeInfo";
		return SQL_ERROR;
	}
	return _fn_SQLGetTypeInfo(StatementHandle, DataType);
}

SQLRETURN SQL_API ODBCWrapper::  SQLGetTypeInfoW( SQLHSTMT            StatementHandle, SQLSMALLINT         DataType)  {
	if (_fn_SQLGetTypeInfoW==NULL) {
		wcerr << "NULL function pointer for   SQLGetTypeInfoW";
		return SQL_ERROR;
	}
	return _fn_SQLGetTypeInfoW(StatementHandle, DataType);
}

SQLRETURN SQL_API ODBCWrapper::SQLMoreResults( SQLHSTMT           hstmt)  {
	if (_fn_SQLMoreResults==NULL) {
		wcerr << "NULL function pointer for SQLMoreResults";
		return SQL_ERROR;
	}
	return _fn_SQLMoreResults(hstmt);
}

SQLRETURN SQL_API ODBCWrapper::SQLNativeSql ( SQLHDBC            hdbc, __in_ecount(cchSqlStrIn) SQLCHAR* szSqlStrIn, SQLINTEGER  cchSqlStrIn, __out_ecount_opt(cchSqlStrMax) SQLCHAR* szSqlStr, SQLINTEGER         cchSqlStrMax, SQLINTEGER        *pcbSqlStr )  {
	if (_fn_SQLNativeSql ==NULL) {
		wcerr << "NULL function pointer for SQLNativeSql ";
		return SQL_ERROR;
	}
	return _fn_SQLNativeSql (hdbc, szSqlStrIn, cchSqlStrIn, szSqlStr, cchSqlStrMax, pcbSqlStr);
}

SQLRETURN SQL_API ODBCWrapper::SQLNativeSqlW ( SQLHDBC                                     hdbc, __in_ecount(cchSqlStrIn) SQLWCHAR*          szSqlStrIn, SQLINTEGER                                  cchSqlStrIn, __out_ecount_opt(cchSqlStrMax) SQLWCHAR*    szSqlStr, SQLINTEGER                                  cchSqlStrMax, SQLINTEGER*                                 pcchSqlStr )  {
	if (_fn_SQLNativeSqlW ==NULL) {
		wcerr << "NULL function pointer for SQLNativeSqlW ";
		return SQL_ERROR;
	}
	return _fn_SQLNativeSqlW (hdbc, szSqlStrIn, cchSqlStrIn, szSqlStr, cchSqlStrMax, pcchSqlStr);
}

SQLRETURN SQL_API ODBCWrapper::SQLNumResultCols(SQLHSTMT StatementHandle, __out SQLSMALLINT *ColumnCount)  {
	if (_fn_SQLNumResultCols==NULL) {
		wcerr << "NULL function pointer for SQLNumResultCols";
		return SQL_ERROR;
	}
	return _fn_SQLNumResultCols(StatementHandle, ColumnCount);
}

SQLRETURN SQL_API ODBCWrapper::SQLParamData(SQLHSTMT StatementHandle, __out_opt SQLPOINTER *Value)  {
	if (_fn_SQLParamData==NULL) {
		wcerr << "NULL function pointer for SQLParamData";
		return SQL_ERROR;
	}
	return _fn_SQLParamData(StatementHandle, Value);
}

SQLRETURN SQL_API ODBCWrapper::SQLPrepare ( SQLHSTMT StatementHandle, __in_ecount(TextLength) SQLCHAR* StatementText, SQLINTEGER TextLength )  {
	if (_fn_SQLPrepare ==NULL) {
		wcerr << "NULL function pointer for SQLPrepare ";
		return SQL_ERROR;
	}
	return _fn_SQLPrepare (StatementHandle, StatementText, TextLength);
}

SQLRETURN SQL_API ODBCWrapper::SQLPrepareW ( SQLHSTMT    hstmt, __in_ecount(cchSqlStr) SQLWCHAR* szSqlStr, SQLINTEGER  cchSqlStr )  {
	if (_fn_SQLPrepareW ==NULL) {
		wcerr << "NULL function pointer for SQLPrepareW ";
		return SQL_ERROR;
	}
	return _fn_SQLPrepareW (hstmt, szSqlStr, cchSqlStr);
}

SQLRETURN SQL_API ODBCWrapper::SQLPrimaryKeys( SQLHSTMT           hstmt, __in_ecount_opt(cchCatalogName) SQLCHAR           *szCatalogName, SQLSMALLINT        cchCatalogName, __in_ecount_opt(cchSchemaName) SQLCHAR           *szSchemaName, SQLSMALLINT        cchSchemaName, __in_ecount_opt(cchTableName) SQLCHAR           *szTableName, SQLSMALLINT        cchTableName)  {
	if (_fn_SQLPrimaryKeys==NULL) {
		wcerr << "NULL function pointer for SQLPrimaryKeys";
		return SQL_ERROR;
	}
	return _fn_SQLPrimaryKeys(hstmt, szCatalogName, cchCatalogName, szSchemaName, cchSchemaName, szTableName, cchTableName);
}

SQLRETURN SQL_API ODBCWrapper::SQLPrimaryKeysW ( SQLHSTMT           hstmt, __in_ecount_opt(cchCatalogName) SQLWCHAR*    szCatalogName, SQLSMALLINT        cchCatalogName, __in_ecount_opt(cchSchemaName) SQLWCHAR*     szSchemaName, SQLSMALLINT        cchSchemaName, __in_ecount_opt(cchTableName) SQLWCHAR*      szTableName, SQLSMALLINT        cchTableName )  {
	if (_fn_SQLPrimaryKeysW ==NULL) {
		wcerr << "NULL function pointer for SQLPrimaryKeysW ";
		return SQL_ERROR;
	}
	return _fn_SQLPrimaryKeysW (hstmt, szCatalogName, cchCatalogName, szSchemaName, cchSchemaName, szTableName, cchTableName);
}

SQLRETURN SQL_API ODBCWrapper::SQLProcedureColumns( SQLHSTMT           hstmt, __in_ecount_opt(cchCatalogName) SQLCHAR           *szCatalogName, SQLSMALLINT        cchCatalogName, __in_ecount_opt(cchSchemaName) SQLCHAR           *szSchemaName, SQLSMALLINT        cchSchemaName, __in_ecount_opt(cchProcName) SQLCHAR           *szProcName, SQLSMALLINT        cchProcName, __in_ecount_opt(cchColumnName) SQLCHAR           *szColumnName, SQLSMALLINT        cchColumnName)  {
	if (_fn_SQLProcedureColumns==NULL) {
		wcerr << "NULL function pointer for SQLProcedureColumns";
		return SQL_ERROR;
	}
	return _fn_SQLProcedureColumns(hstmt, szCatalogName, cchCatalogName, szSchemaName, cchSchemaName, szProcName, cchProcName, szColumnName, cchColumnName);
}

SQLRETURN SQL_API ODBCWrapper::SQLProcedureColumnsW ( SQLHSTMT           hstmt, __in_ecount_opt(cchCatalogName) SQLWCHAR*    szCatalogName, SQLSMALLINT        cchCatalogName, __in_ecount_opt(cchSchemaName) SQLWCHAR*     szSchemaName, SQLSMALLINT        cchSchemaName, __in_ecount_opt(cchProcName) SQLWCHAR*       szProcName, SQLSMALLINT        cchProcName, __in_ecount_opt(cchColumnName) SQLWCHAR*     szColumnName, SQLSMALLINT        cchColumnName )  {
	if (_fn_SQLProcedureColumnsW ==NULL) {
		wcerr << "NULL function pointer for SQLProcedureColumnsW ";
		return SQL_ERROR;
	}
	return _fn_SQLProcedureColumnsW (hstmt, szCatalogName, cchCatalogName, szSchemaName, cchSchemaName, szProcName, cchProcName, szColumnName, cchColumnName);
}

SQLRETURN SQL_API ODBCWrapper::SQLProcedures( SQLHSTMT           hstmt, __in_ecount_opt(cchCatalogName) SQLCHAR           *szCatalogName, SQLSMALLINT        cchCatalogName, __in_ecount_opt(cchSchemaName) SQLCHAR           *szSchemaName, SQLSMALLINT        cchSchemaName, __in_ecount_opt(cchProcName) SQLCHAR           *szProcName, SQLSMALLINT        cchProcName)  {
	if (_fn_SQLProcedures==NULL) {
		wcerr << "NULL function pointer for SQLProcedures";
		return SQL_ERROR;
	}
	return _fn_SQLProcedures(hstmt, szCatalogName, cchCatalogName, szSchemaName, cchSchemaName, szProcName, cchProcName);
}

SQLRETURN SQL_API ODBCWrapper::SQLProceduresW ( SQLHSTMT           hstmt, __in_ecount_opt(cchCatalogName) SQLWCHAR*    szCatalogName, SQLSMALLINT        cchCatalogName, __in_ecount_opt(cchSchemaName) SQLWCHAR*     szSchemaName, SQLSMALLINT        cchSchemaName, __in_ecount_opt(cchProcName) SQLWCHAR*      szProcName, SQLSMALLINT        cchProcName )  {
	if (_fn_SQLProceduresW ==NULL) {
		wcerr << "NULL function pointer for SQLProceduresW ";
		return SQL_ERROR;
	}
	return _fn_SQLProceduresW (hstmt, szCatalogName, cchCatalogName, szSchemaName, cchSchemaName, szProcName, cchProcName);
}

SQLRETURN SQL_API ODBCWrapper::SQLPutData(SQLHSTMT StatementHandle, __in_xcount(StrLen_or_Ind) SQLPOINTER Data, SQLLEN StrLen_or_Ind)  {
	if (_fn_SQLPutData==NULL) {
		wcerr << "NULL function pointer for SQLPutData";
		return SQL_ERROR;
	}
	return _fn_SQLPutData(StatementHandle, Data, StrLen_or_Ind);
}

SQLRETURN SQL_API ODBCWrapper::SQLRowCount(__in SQLHSTMT StatementHandle, __out SQLLEN* RowCount)  {
	if (_fn_SQLRowCount==NULL) {
		wcerr << "NULL function pointer for SQLRowCount";
		return SQL_ERROR;
	}
	return _fn_SQLRowCount(StatementHandle, RowCount);
}

SQLRETURN SQL_API ODBCWrapper::SQLSetConnectAttr(SQLHDBC ConnectionHandle, SQLINTEGER Attribute, __in_bcount_opt(StringLength) SQLPOINTER Value, SQLINTEGER StringLength)  {
	if (_fn_SQLSetConnectAttr==NULL) {
		wcerr << "NULL function pointer for SQLSetConnectAttr";
		return SQL_ERROR;
	}
	return _fn_SQLSetConnectAttr(ConnectionHandle, Attribute, Value, StringLength);
}

SQLRETURN SQL_API ODBCWrapper::SQLSetConnectAttrW( SQLHDBC            hdbc, SQLINTEGER         fAttribute, __in_bcount_opt(cbValue) SQLPOINTER         rgbValue, SQLINTEGER         cbValue)  {
	if (_fn_SQLSetConnectAttrW==NULL) {
		wcerr << "NULL function pointer for SQLSetConnectAttrW";
		return SQL_ERROR;
	}
	return _fn_SQLSetConnectAttrW(hdbc, fAttribute, rgbValue, cbValue);
}

SQLRETURN SQL_API ODBCWrapper::SQLSetCursorName ( SQLHSTMT StatementHandle, __in_ecount(NameLength) SQLCHAR* CursorName, SQLSMALLINT NameLength )  {
	if (_fn_SQLSetCursorName ==NULL) {
		wcerr << "NULL function pointer for SQLSetCursorName ";
		return SQL_ERROR;
	}
	return _fn_SQLSetCursorName (StatementHandle, CursorName, NameLength);
}

SQLRETURN SQL_API ODBCWrapper::SQLSetCursorNameW ( SQLHSTMT            hstmt, __in_ecount(cchCursor) SQLWCHAR* szCursor, SQLSMALLINT         cchCursor )  {
	if (_fn_SQLSetCursorNameW ==NULL) {
		wcerr << "NULL function pointer for SQLSetCursorNameW ";
		return SQL_ERROR;
	}
	return _fn_SQLSetCursorNameW (hstmt, szCursor, cchCursor);
}

SQLRETURN SQL_API ODBCWrapper::SQLSetDescField(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier, __in_xcount(BufferLength) SQLPOINTER Value, SQLINTEGER BufferLength)  {
	if (_fn_SQLSetDescField==NULL) {
		wcerr << "NULL function pointer for SQLSetDescField";
		return SQL_ERROR;
	}
	return _fn_SQLSetDescField(DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength);
}

SQLRETURN SQL_API ODBCWrapper::SQLSetDescFieldW ( SQLHDESC        DescriptorHandle, SQLSMALLINT     RecNumber, SQLSMALLINT     FieldIdentifier, SQLPOINTER      Value, SQLINTEGER      BufferLength )  {
	if (_fn_SQLSetDescFieldW ==NULL) {
		wcerr << "NULL function pointer for SQLSetDescFieldW ";
		return SQL_ERROR;
	}
	return _fn_SQLSetDescFieldW (DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength);
}

SQLRETURN SQL_API ODBCWrapper::SQLSetDescRec(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber, SQLSMALLINT Type, SQLSMALLINT SubType, SQLLEN Length, SQLSMALLINT Precision, SQLSMALLINT Scale, __inout_bcount_opt(Length) SQLPOINTER Data, __inout_opt SQLLEN *StringLength, __inout_opt SQLLEN *Indicator)  {
	if (_fn_SQLSetDescRec==NULL) {
		wcerr << "NULL function pointer for SQLSetDescRec";
		return SQL_ERROR;
	}
	return _fn_SQLSetDescRec(DescriptorHandle, RecNumber, Type, SubType, Length, Precision, Scale, Data, StringLength, Indicator);
}

SQLRETURN SQL_API ODBCWrapper::SQLSetEnvAttr(SQLHENV EnvironmentHandle, SQLINTEGER Attribute, __in_bcount(StringLength) SQLPOINTER Value, SQLINTEGER StringLength)  {
	if (_fn_SQLSetEnvAttr==NULL) {
		wcerr << "NULL function pointer for SQLSetEnvAttr";
		return SQL_ERROR;
	}
	return _fn_SQLSetEnvAttr(EnvironmentHandle, Attribute, Value, StringLength);
}

SQLRETURN SQL_API ODBCWrapper::SQLSetPos( SQLHSTMT           hstmt, SQLSETPOSIROW      irow, SQLUSMALLINT       fOption, SQLUSMALLINT       fLock)  {
	if (_fn_SQLSetPos==NULL) {
		wcerr << "NULL function pointer for SQLSetPos";
		return SQL_ERROR;
	}
	return _fn_SQLSetPos(hstmt, irow, fOption, fLock);
}

SQLRETURN SQL_API ODBCWrapper::SQLSetScrollOptions( SQLHSTMT           hstmt, SQLUSMALLINT       fConcurrency, SQLLEN             crowKeyset, SQLUSMALLINT       crowRowset)  {
	if (_fn_SQLSetScrollOptions==NULL) {
		wcerr << "NULL function pointer for SQLSetScrollOptions";
		return SQL_ERROR;
	}
	return _fn_SQLSetScrollOptions(hstmt, fConcurrency, crowKeyset, crowRowset);
}

SQLRETURN SQL_API ODBCWrapper::SQLSetStmtAttr(SQLHSTMT StatementHandle, SQLINTEGER Attribute, __in_xcount(StringLength) SQLPOINTER Value, SQLINTEGER StringLength)  {
	if (_fn_SQLSetStmtAttr==NULL) {
		wcerr << "NULL function pointer for SQLSetStmtAttr";
		return SQL_ERROR;
	}
	return _fn_SQLSetStmtAttr(StatementHandle, Attribute, Value, StringLength);
}

SQLRETURN SQL_API ODBCWrapper::SQLSetStmtAttrW( SQLHSTMT           hstmt, SQLINTEGER         fAttribute, SQLPOINTER         rgbValue, SQLINTEGER         cbValueMax)  {
	if (_fn_SQLSetStmtAttrW==NULL) {
		wcerr << "NULL function pointer for SQLSetStmtAttrW";
		return SQL_ERROR;
	}
	return _fn_SQLSetStmtAttrW(hstmt, fAttribute, rgbValue, cbValueMax);
}

SQLRETURN SQL_API ODBCWrapper::SQLSpecialColumns(SQLHSTMT StatementHandle, SQLUSMALLINT IdentifierType, __in_ecount_opt(NameLength1) SQLCHAR *CatalogName, SQLSMALLINT NameLength1, __in_ecount_opt(NameLength2) SQLCHAR *SchemaName, SQLSMALLINT NameLength2, __in_ecount_opt(NameLength3) SQLCHAR *TableName, SQLSMALLINT NameLength3, SQLUSMALLINT Scope, SQLUSMALLINT Nullable)  {
	if (_fn_SQLSpecialColumns==NULL) {
		wcerr << "NULL function pointer for SQLSpecialColumns";
		return SQL_ERROR;
	}
	return _fn_SQLSpecialColumns(StatementHandle, IdentifierType, CatalogName, NameLength1, SchemaName, NameLength2, TableName, NameLength3, Scope, Nullable);
}

SQLRETURN SQL_API ODBCWrapper::SQLSpecialColumnsW ( SQLHSTMT           hstmt, SQLUSMALLINT       fColType, __in_ecount_opt(cchCatalogName) SQLWCHAR*    szCatalogName, SQLSMALLINT        cchCatalogName, __in_ecount_opt(cchSchemaName) SQLWCHAR*     szSchemaName, SQLSMALLINT        cchSchemaName, __in_ecount_opt(cchTableName) SQLWCHAR*      szTableName, SQLSMALLINT        cchTableName, SQLUSMALLINT       fScope, SQLUSMALLINT       fNullable )  {
	if (_fn_SQLSpecialColumnsW ==NULL) {
		wcerr << "NULL function pointer for SQLSpecialColumnsW ";
		return SQL_ERROR;
	}
	return _fn_SQLSpecialColumnsW (hstmt, fColType, szCatalogName, cchCatalogName, szSchemaName, cchSchemaName, szTableName, cchTableName, fScope, fNullable);
}

SQLRETURN SQL_API ODBCWrapper::SQLStatistics(SQLHSTMT StatementHandle, __in_ecount_opt(NameLength1) SQLCHAR *CatalogName, SQLSMALLINT NameLength1, __in_ecount_opt(NameLength2) SQLCHAR *SchemaName, SQLSMALLINT NameLength2, __in_ecount_opt(NameLength3) SQLCHAR *TableName, SQLSMALLINT NameLength3, SQLUSMALLINT Unique, SQLUSMALLINT Reserved)  {
	if (_fn_SQLStatistics==NULL) {
		wcerr << "NULL function pointer for SQLStatistics";
		return SQL_ERROR;
	}
	return _fn_SQLStatistics(StatementHandle, CatalogName, NameLength1, SchemaName, NameLength2, TableName, NameLength3, Unique, Reserved);
}

SQLRETURN SQL_API ODBCWrapper::SQLStatisticsW ( SQLHSTMT           hstmt, __in_ecount_opt(cchCatalogName) SQLWCHAR*    szCatalogName, SQLSMALLINT        cchCatalogName, __in_ecount_opt(cchSchemaName) SQLWCHAR*     szSchemaName, SQLSMALLINT        cchSchemaName, __in_ecount_opt(cchTableName) SQLWCHAR*      szTableName, SQLSMALLINT        cchTableName, SQLUSMALLINT       fUnique, SQLUSMALLINT       fAccuracy )  {
	if (_fn_SQLStatisticsW ==NULL) {
		wcerr << "NULL function pointer for SQLStatisticsW ";
		return SQL_ERROR;
	}
	return _fn_SQLStatisticsW (hstmt, szCatalogName, cchCatalogName, szSchemaName, cchSchemaName, szTableName, cchTableName, fUnique, fAccuracy);
}

SQLRETURN SQL_API ODBCWrapper::SQLTablePrivileges( SQLHSTMT           hstmt, __in_ecount_opt(cchCatalogName) SQLCHAR           *szCatalogName, SQLSMALLINT        cchCatalogName, __in_ecount_opt(cchSchemaName) SQLCHAR           *szSchemaName, SQLSMALLINT        cchSchemaName, __in_ecount_opt(cchTableName) SQLCHAR           *szTableName, SQLSMALLINT        cchTableName)  {
	if (_fn_SQLTablePrivileges==NULL) {
		wcerr << "NULL function pointer for SQLTablePrivileges";
		return SQL_ERROR;
	}
	return _fn_SQLTablePrivileges(hstmt, szCatalogName, cchCatalogName, szSchemaName, cchSchemaName, szTableName, cchTableName);
}

SQLRETURN SQL_API ODBCWrapper::SQLTablePrivilegesW ( SQLHSTMT           hstmt, __in_ecount_opt(cchCatalogName) SQLWCHAR*    szCatalogName, SQLSMALLINT        cchCatalogName, __in_ecount_opt(cchSchemaName) SQLWCHAR*     szSchemaName, SQLSMALLINT        cchSchemaName, __in_ecount_opt(cchTableName) SQLWCHAR*      szTableName, SQLSMALLINT        cchTableName )  {
	if (_fn_SQLTablePrivilegesW ==NULL) {
		wcerr << "NULL function pointer for SQLTablePrivilegesW ";
		return SQL_ERROR;
	}
	return _fn_SQLTablePrivilegesW (hstmt, szCatalogName, cchCatalogName, szSchemaName, cchSchemaName, szTableName, cchTableName);
}

SQLRETURN SQL_API ODBCWrapper::SQLTables(SQLHSTMT StatementHandle, __in_ecount_opt(NameLength1) SQLCHAR *CatalogName, SQLSMALLINT NameLength1, __in_ecount_opt(NameLength2) SQLCHAR *SchemaName, SQLSMALLINT NameLength2, __in_ecount_opt(NameLength3) SQLCHAR *TableName, SQLSMALLINT NameLength3, __in_ecount_opt(NameLength4) SQLCHAR *TableType, SQLSMALLINT NameLength4)  {
	if (_fn_SQLTables==NULL) {
		wcerr << "NULL function pointer for SQLTables";
		return SQL_ERROR;
	}
	return _fn_SQLTables(StatementHandle, CatalogName, NameLength1, SchemaName, NameLength2, TableName, NameLength3, TableType, NameLength4);
}

SQLRETURN SQL_API ODBCWrapper::SQLTablesW ( SQLHSTMT           hstmt, __in_ecount_opt(cchCatalogName) SQLWCHAR*    szCatalogName, SQLSMALLINT        cchCatalogName, __in_ecount_opt(cchSchemaName) SQLWCHAR*     szSchemaName, SQLSMALLINT        cchSchemaName, __in_ecount_opt(cchTableName) SQLWCHAR*      szTableName, SQLSMALLINT        cchTableName, __in_ecount_opt(cchTableType) SQLWCHAR*      szTableType, SQLSMALLINT        cchTableType )  {
	if (_fn_SQLTablesW ==NULL) {
		wcerr << "NULL function pointer for SQLTablesW ";
		return SQL_ERROR;
	}
	return _fn_SQLTablesW (hstmt, szCatalogName, cchCatalogName, szSchemaName, cchSchemaName, szTableName, cchTableName, szTableType, cchTableType);
}

SQLRETURN SQL_API ODBCWrapper::SQLTransact(SQLHENV EnvironmentHandle, SQLHDBC ConnectionHandle, SQLUSMALLINT CompletionType)  {
	if (_fn_SQLTransact==NULL) {
		wcerr << "NULL function pointer for SQLTransact";
		return SQL_ERROR;
	}
	return _fn_SQLTransact(EnvironmentHandle, ConnectionHandle, CompletionType);
}